package com.atguigu.service.impl;


import com.alibaba.dubbo.config.annotation.Service;
import com.atguigu.base.BaseMapper;
import com.atguigu.base.BaseServiceImpl;
import com.atguigu.entity.Admin;
import com.atguigu.mapper.AdminMapper;
import com.atguigu.service.AdminService;
import org.springframework.transaction.annotation.Transactional;


import javax.annotation.Resource;
import java.util.List;
@Transactional
@Service(interfaceClass = AdminService.class)
public class AdminServiceImpl extends BaseServiceImpl<Admin> implements AdminService {
//    默认按照class进行装配
//    @Autowired
//默认按照类名进行装配
    @Resource
    private AdminMapper adminMapper;


    @Override
    protected BaseMapper<Admin> getEntityMapper() {
        return adminMapper;
    }

    @Override
    public List<Admin> findAll() {
        return adminMapper.findAll();
    }

    @Override
    public Admin getByUserName(String username) {
        return adminMapper.getByUserName(username);
    }

//    @Override
//    public Integer insert(Admin role) {
//        return roleMapper.insert(role);
//    }

//    @Override
//    public Admin getById(Long id) {
//        return roleMapper.getById(id);
//    }
//
//    @Override
//    public Integer update(Admin role) {
//        return roleMapper.update(role);
//    }
//
//    @Override
//    public Admin getById(Serializable id) {
//        return null;
//    }
//
//    @Override
//    public Integer delete(Long id) {
//        return roleMapper.delete(id);
//    }
//
//    @Override
//    public PageInfo<Admin> findPage(Map<String, Object> filters) {
//        int pageNum = CastUtil.castInt(filters.get("pageNum"), 1);
//        int pageSize = CastUtil.castInt(filters.get("pageSize"), 10);
//        //开始分页
//        PageHelper.startPage(pageNum, pageSize);
//        return new PageInfo<Admin>(roleMapper.findPage(filters),10);
//    }


}
